package JavaBase.Polymorphism;

public class Animal_Test {
    public static void main(String[] args) {
        Animal animal;
        animal=new Cat();
        animal.eat();
        animal.cry();
        if(animal instanceof Cat)
        {
            Cat cat = (Cat) animal;
            cat.catchMouse();
        }
        //((Cat) animal).catchMouse();
        animal=new Dog();
        animal.eat();
        animal.cry();
        if(animal instanceof Dog)
        {
            Dog dog = (Dog) animal;
            dog.lookHouse();
        }
        //((Dog) animal).lookHouse();
        animal=new Eagle();
        animal.eat();
        animal.cry();
        if(animal instanceof Eagle)
        {
            Eagle eagle = (Eagle) animal;
            eagle.hunt();
        }
        //((Eagle) animal).hunt();
    }
}
